#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n;
void solve()
{
	cin>>n;
	int x=0,y=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='U') y++;
		else if(s[i]=='L') x--;
		else if(s[i]=='R') x++;
		else if(s[i]=='D') y--;
		if(x==1&&y==1)
		{
			cout<<"YES"<<'\n';
			return;
		}
	}
	cout<<"NO"<<'\n';

	
}

int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}